package com.yang.qgg_demo.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yang.qgg_demo.entity.Menu;
import com.yang.qgg_demo.entity.User;
import com.yang.qgg_demo.mapper.MenuMapper;
import com.yang.qgg_demo.service.IMenuService;
import com.yang.qgg_demo.service.IUserService;
import com.yang.qgg_demo.utils.TokenUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;

import java.util.LinkedList;
import java.util.List;

import com.yang.qgg_demo.service.ISysRoleService;
import com.yang.qgg_demo.entity.SysRole;


/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author yang
 * @since 2024-10-28
 */
@RestController
@Slf4j
@RequestMapping("/role")
    public class SysRoleController {
    
    @Resource
    private ISysRoleService sysRoleService;

    @Resource
    private MenuMapper menuMapper;

    @PostMapping("/save")
    public Boolean save(@RequestBody SysRole sysRole) {
        return sysRoleService.saveOrUpdate(sysRole);
    }

    @DeleteMapping("/{id}")
    public Boolean delete(@PathVariable Integer id) {
        return sysRoleService.removeById(id);
    }

    @GetMapping
    public List<SysRole> findAll() {
        return sysRoleService.list();
    }

    @GetMapping("/{id}")
    public SysRole findOne(@PathVariable Integer id) {
        return sysRoleService.getById(id);
    }


}

